import React, { Component } from 'react'

class Detail extends Component {
    state={
        list:[]
    }
    componentDidMount(){
        this.setState({
            list:this.props.history.location.item
        })
    }
    goBack(){
        this.props.history.go(-1)
    }
  render() {
    return (
      <div>
         <p onClick={this.goBack.bind(this)}>返回</p>
         <div>
             <p>{this.state.list.title}</p>
             <img src={this.state.list.img} alt="" />
         </div>
      </div>
    )
  }
}

export default Detail
